package Text6;

import java.util.*;

public class Main {
    // 从 1∼n这 n个整数中随机选出 m 个，输出所有可能的选择方案。
    static final int N = 50;
    static int n, m;
    static int[] way = new int[N];

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        n = scanner.nextInt();
        m = scanner.nextInt();
        dfs(1, 1);
    }

    private static void dfs(int u, int start) {
        if (u > m) {
            for (int i = 1; i <= m; i++) {
                System.out.print(way[i] + " ");
            }
            System.out.println();
            return;
        }
        for (int i = start; i <=n ; i++) {
            way[u]=i;
            dfs(u+1,i+1);
            way[u]=0;
        }
    }

}
